<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
      <!-- <el-form-item prop="deptId">
        <treeselect v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="部门"
          style="width: 480px"/>
      </el-form-item> -->
      <el-form-item prop="storeId">
        <!-- <treeselect v-model="queryParams.storeId" :options="storeOptions" :show-count="true" placeholder="仓库"
          style="width: 120px"/> -->
          <el-select v-model="queryParams.storeId" placeholder="仓库" clearable size="small">
              <el-option v-for="dict in storeOptions" :key="dict.id" :label="dict.label"
                :value="dict.id" />
            </el-select>

      </el-form-item>
      <el-form-item prop="taskNo">
        <el-input v-model="queryParams.taskNo" placeholder="申请编号搜索" clearable size="small"
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item prop="proKey">
        <el-input v-model="queryParams.proKey" placeholder="物品编号/名称/特征关键字搜索" clearable size="small"
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <!-- <el-form-item prop="delivery">
        <el-select v-model="queryParams.delivery" placeholder="配送方式" clearable size="small">
          <el-option v-for="dict in dict.type.oms_delivery_type" :key="dict.value" :label="dict.label"
            :value="dict.value" />
        </el-select>
      </el-form-item> -->
      <!-- <el-form-item prop="status">
        <el-select v-model="queryParams.status" placeholder="状态" clearable size="small">
          <el-option v-for="dict in dict.type.sys_common_status" :key="dict.value" :label="dict.label"
            :value="dict.value" />
        </el-select>
      </el-form-item> -->
      <el-form-item prop="daterangeCreateTime">
        <!-- <el-date-picker clearable  v-model="queryParams.orderTime" type="date" value-format="yyyy-MM-dd"
          placeholder="下单时间">
        </el-date-picker> -->
        <el-date-picker v-model="daterangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
          type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>

      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        <el-button type="danger" plain icon="el-icon-s-unfold" size="mini" :disabled="multiple" @click="handleSendAll" v-hasPermi="['oms:task:add']">下发</el-button>
<!--        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['oms:task:add']">新增</el-button>-->
<!--        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['oms:task:edit']">修改</el-button>-->
      </el-form-item>
    </el-form>
    <!-- <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['oms:task:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
          v-hasPermi="['oms:task:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
          v-hasPermi="['oms:task:remove']">删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['oms:task:export']">导出</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-s-unfold" size="mini" :disabled="multiple" @click="handleSend"
          v-hasPermi="['oms:task:add']">下发</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row> -->
    <el-row>
      <el-col :span="8" class="mb10">
        <el-radio-group v-model="queryParams.sendStatus" @change="radioChange" size="mini">
          <el-radio-button v-for="tab in tabs" :label="tab.label" >
            <el-badge :value="tab.badge" class="item">
              {{tab.name}}
            </el-badge>
          </el-radio-button>
        </el-radio-group>
        <el-radio-group v-model="xzTabVal" @change="xzTabChange"  size="mini" style="margin-left:30px">
          <el-radio-button v-for="tab in xzTabs" :label="tab.label">
            <el-badge :value="tab.badge" class="item">
              {{ tab.name }}
            </el-badge>
          </el-radio-button>
        </el-radio-group>
      </el-col>

      <el-col :span="16">
        <template v-for="item in statisticsOptions">
          <el-badge :value="item.totals" class="item ml10" :is-dot="item.totals>0?false:true" :type="item.totals>0?'danger':'info'">
            <el-button @click="statisticsChange(item)" size="mini" :type="item.region == queryParams.region ? 'primary':''" :plain="item.region == queryParams.region">{{item.regionName}}</el-button>
          </el-badge>
        </template>
      </el-col>
    </el-row>
    <el-table v-loading="loading" :data="taskList" @selection-change="handleSelectionChange" border stripe>
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column label="申请编号"  prop="taskNo" width="130">
        <template slot-scope="scope">
          <el-link type="primary" @click="handleInfo(scope.row)">{{scope.row.taskNo}}</el-link>
        </template>
      </el-table-column>
      <el-table-column label="申请部门" prop="deptName" min-width="120"/>
      <!-- <el-table-column label="姓名"  prop="name" width="110"/> -->
      <!-- <el-table-column label="联系方式"  prop="tel" width="120" /> -->
      <!-- <el-table-column label="仓库" prop="storeName" width="260"/> -->
      <!-- <el-table-column label="数量" align="center" prop="nums" width="80"/> -->
   <!--   <el-table-column label="物品类型" align="center" prop="propertyType" width="110">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.oms_property_type" :value="scope.row.propertyType" />
         </template>
      </el-table-column> -->
      <el-table-column label="配送部门" align="center" prop="deliveryDept" min-width="80"></el-table-column>
      <!-- <el-table-column label="类型" align="center" prop="type" width="100">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.oms_task_type" :value="scope.row.type" />
         </template>
      </el-table-column> -->
      <!-- <el-table-column label="备注" align="center" prop="remark" width="200"/> -->

      <!-- <el-table-column label="状态" align="center" prop="status" >
        <template slot-scope="scope">
          <dict-tag :options="dict.type.oms_task_status" :value="scope.row.status" />
        </template>
      </el-table-column> -->
     <el-table-column label="审核状态" align="center" prop="checkStatus" width="160">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_check_status" :value="scope.row.checkStatus" />
        </template>
      </el-table-column>
      <el-table-column label="下发状态" align="center" prop="sendStatus"  v-if="!queryParams.sendStatus">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.oms_send_status" :value="scope.row.sendStatus" />
        </template>
      </el-table-column>
      <el-table-column label="是否取证" align="center" prop="evidence">
        <template slot-scope="scope">
          <el-tag :type="scope.row.evidence == '0'?'info':'success'">{{scope.row.evidence == '0'?'否':'是'}}</el-tag>
        </template>
      </el-table-column>
      <!-- <el-table-column label="来源" align="source" prop="source" fixed="right" width="100">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.oms_task_source" :value="scope.row.source" />
        </template>
      </el-table-column> -->
      <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" prop="createTime" width="160">
        <template slot-scope="scope">
          <el-button type="text"  icon="el-icon-s-check" size="mini" v-if="scope.row.checkStatus == '0'"  @click="handleCheck(scope.row)"
            v-hasPermi="['oms:task:edit']">审核</el-button>
         <!-- <el-tag v-if="scope.row.checkStatus == '1'" type="success">已审核</el-tag>
          <el-tag v-if="scope.row.checkStatus == '2'" type="info">已审核</el-tag> -->
          <el-button size="mini" v-if="scope.row.checkStatus == '1'" type="text" icon="el-icon-view" @click="handleInfo(scope.row)"
            v-hasPermi="['oms:task:edit']">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />
    <el-drawer :title="title" :visible.sync="open" size="75%" :before-close="close">
        <div class="mb20 ml20">
          <span style="font-size: 20px;">{{form.taskNo}}</span>
          <div class="fr mr10">
            <el-button type="primary" size="mini" v-if="form.status == '0'"  @click="handleUpdate(form)">编辑</el-button>
            <el-button  size="mini" @click="handleSend(form)" v-if="form.sendReStatus == '0' || !form.sendReStatus">下发</el-button>
          </div>
        </div>
        <el-card>
         <el-tabs v-model="activeName">
            <el-tab-pane label="申请详情" name="1">
              <el-card>
                <el-descriptions title="基本信息" :column="4" border>
                  <el-descriptions-item label="申请单位" :span="2">{{form.deptName}}</el-descriptions-item>
                  <el-descriptions-item label="申请人">{{form.name}}</el-descriptions-item>
                  <el-descriptions-item label="联系电话">{{form.tel}}</el-descriptions-item>
                  <el-descriptions-item v-if="form.delivery == '0'" label="联系地址" :span="4">{{form.address}}</el-descriptions-item>
                  <el-descriptions-item label="物流配送">
                    <dict-tag :options="dict.type.oms_out_delivery_type" :value="form.delivery" />
                  </el-descriptions-item>
                  <!-- <el-descriptions-item :label="form.delivery == '0'?'期望上门时间':'预计到货时间'">
                    <span>{{ parseTime(form.expectTime, '{y}-{m}-{d}') }}</span>
                  </el-descriptions-item> -->
                  <el-descriptions-item label="调用数量">{{form.properties}}</el-descriptions-item>
                  <!-- <el-descriptions-item label="是否拖车">{{form.isTrailer == '0'?'否':'是'}}</el-descriptions-item> -->
                  <el-descriptions-item label="调用仓库">{{form.storeName}}</el-descriptions-item>
                  <el-descriptions-item label="有无钥匙" v-if="form.carKey">{{form.carKey}}</el-descriptions-item>
                  <el-descriptions-item label="有无行驶证" v-if="form.driveLicen">{{form.driveLicen}}</el-descriptions-item>
                  <el-descriptions-item label="无" v-if="form.othreNone">{{form.othreNone}}</el-descriptions-item>
                  <el-descriptions-item label="是否取证">
                    <el-tag :type="form.evidence == '0'?'info':'success'">{{form.evidence == '0'?'否':'是'}}</el-tag>
                  </el-descriptions-item>
                  <el-descriptions-item label="调用原因" :span="4">{{form.dispatchRemark}}</el-descriptions-item>
                  <el-descriptions-item label="附件" :span="4">
                    <!-- <el-image v-if="form.oss && form.oss.length > 0"
                      style="width: 120px; height: 60px;margin-right: 5px;" :src="ossTransfer(form.oss,'one')" fit="scale-down"
                      :preview-src-list="ossTransfer(form.oss,'list')"></el-image> -->
                      <el-image v-if="form.oss && form.oss.length > 0" v-for="(pic,pindex) in form.oss"
                      style="width: 120px; height: 60px;margin-right: 5px;" :src="ossTransferThumbnail(pic,'one')" fit="scale-down"
                      :preview-src-list="ossTransfer(form.oss,'list')"></el-image>
                  </el-descriptions-item>
                </el-descriptions>
              </el-card>
              <el-card v-if="show" class="mt10">
                <el-descriptions title="下发信息" :column="3" border>
                  <el-descriptions-item label="存放位置" :span="3">
                    <el-radio-group v-model="sendTaskForm.storeId">
                      <el-radio-button v-for="item in storeOptions" :key="item.id" :label="item.id">
                        {{item.label}}
                      </el-radio-button>
                    </el-radio-group>
                  </el-descriptions-item>
                  <el-descriptions-item label="承运商" :span="3">
                    <el-radio-group v-model="sendTaskForm.carrierDeptId">
                      <el-radio-button v-for="item in carrierOptions" :key="item.deptId" :label="item.deptId">
                        {{item.carrierName}}
                      </el-radio-button>
                    </el-radio-group>
                  </el-descriptions-item>
                  <template>
                    <el-descriptions-item label="派遣车辆" :span="1">
                      <el-select v-model="sendTaskForm.carId">
                        <el-option v-for="item in carOptions" :key="item.id" :label="item.carNumber" :value="item.id"></el-option>
                      </el-select>
                    </el-descriptions-item>
                    <el-descriptions-item label="取件人" :span="1">
                      <el-select v-model="sendTaskForm.pickupId">
                        <el-option v-for="item in userOptions" :key="item.userId" :label="item.nickName" :value="item.userId"></el-option>
                      </el-select>
                    </el-descriptions-item>
                    <el-descriptions-item label="签收人" :span="1">
                      <el-input v-model="sendTaskForm.signeeName" type="text">
                        {{sendTaskForm.signeeName}}
                      </el-input>
                    </el-descriptions-item>
                  </template>
                </el-descriptions>
                <div class="mt10 fr mb10">
                  <el-button type="primary" :loading="buttonLoading" @click="submitForm" size="mini">确 定</el-button>
                  <el-button @click="handleClose" size="mini">取 消</el-button>
                </div>
              </el-card>
              <handover-order :form="form" :handoverOptions="handoverOptions" v-if="handoverOptions == null || handoverOptions.length == 0"></handover-order>
            </el-tab-pane>
            <el-tab-pane label="物品清单" name="2">
              <el-table :data="form.items"  border stripe>
                <el-table-column type="index" width="55" align="center"></el-table-column>
                <el-table-column label="物品编号" align="left" prop="pno" width="260">
                  <template slot-scope="scope">
                    <span>{{scope.row.pno}}</span>
                  </template>
                </el-table-column>
                <el-table-column label="物品名称" align="left" prop="name" width="200">
                  <template slot-scope="scope">
                    <span>{{scope.row.name}}</span>
                  </template>
                </el-table-column>
                <el-table-column label="数量" align="center" prop="nums" width="75">
                  <template slot-scope="scope">
                    <span>{{scope.row.nums}}</span>
                  </template>
                </el-table-column>
                <!-- <el-table-column label="箱号" align="center" prop="boxNo">
                  <template slot-scope="scope" v-if="scope.row.boxNo">
                    <el-tag>{{scope.row.boxNo}}</el-tag>
                  </template>
                </el-table-column> -->
                <el-table-column label="图片" align="left" prop="oss">
                  <template slot-scope="scope">
                      <el-image v-if="scope.row.oss && scope.row.oss.length > 0" v-for="(pic,pindex) in scope.row.oss"
                      style="width: 120px; height: 60px;margin-right: 5px;" :src="ossTransferThumbnail(pic,'one')" fit="scale-down"
                      :preview-src-list="ossTransfer(scope.row.oss,'list')"></el-image>
                  </template>
                </el-table-column>
              </el-table>
            </el-tab-pane>
            <el-tab-pane label="交接信息" name="3" v-if="handoverOptions && handoverOptions.length > 0">
              <handover-order :form="form" :handoverOptions="handoverOptions" v-if="handoverOptions && handoverOptions.length > 0"></handover-order>
            </el-tab-pane>
            <el-tab-pane label="交接原件" name="4" v-if="handoverOssList && handoverOssList.length > 0">
              <el-image  v-for="(pic,pindex) in handoverOssList"
              style="width: 100%;" :src="ossTransfer(pic,'list')" fit="scale-down"
              :preview-src-list="ossTransfer(handoverOssList,'list')"></el-image>
            </el-tab-pane>
            <el-tab-pane label="配送信息" name="5" v-if="orderOptions">
               <el-tabs tab-position="left">
                  <el-tab-pane label="订单信息">
                    <el-descriptions title="基本信息" :column="3" border>
                      <el-descriptions-item label="订单编号">{{orderOptions.orderNo}}</el-descriptions-item>
                      <el-descriptions-item label="所属部门">{{orderOptions.deptName}}</el-descriptions-item>
                      <el-descriptions-item label="物品数量">{{orderOptions.nums}}</el-descriptions-item>
                      <el-descriptions-item label="客户名称" v-if="orderOptions.clientName">{{orderOptions.clientName}}</el-descriptions-item>
                      <el-descriptions-item label="联系人" v-if="orderOptions.clientContacts">{{orderOptions.clientContacts}}</el-descriptions-item>
                      <el-descriptions-item label="联系电话" v-if="orderOptions.clientTel">{{orderOptions.clientTel}}</el-descriptions-item>
                      <el-descriptions-item label="备注" :span="3">{{orderOptions.memo}}</el-descriptions-item>
                    </el-descriptions>
                    <el-descriptions title="寄收地址" :column="3" border style="margin-top: 15px;">
                      <el-descriptions-item label="寄件单位">{{orderOptions.sendAddr}}</el-descriptions-item>
                      <el-descriptions-item label="寄件联系人">{{orderOptions.sendContacts}}</el-descriptions-item>
                      <el-descriptions-item label="联系方式">{{orderOptions.sendTel}}</el-descriptions-item>
                      <el-descriptions-item label="寄件地址" :span="3">{{orderOptions.sendAddress}}</el-descriptions-item>
                      <el-descriptions-item label="收件单位">{{orderOptions.takeAddr}}</el-descriptions-item>
                      <el-descriptions-item label="收件联系人">{{orderOptions.takeContacts}}</el-descriptions-item>
                      <el-descriptions-item label="联系方式">{{orderOptions.takeTel}}</el-descriptions-item>
                      <el-descriptions-item label="收件地址" :span="3">{{orderOptions.takeAddress}}</el-descriptions-item>
                    </el-descriptions>
                    <el-card style="margin-top: 15px;">
                      <div slot="header" class="clearfix">
                        <span style="font-weight: bold;">物品清单</span>
                      </div>
                      <el-table :data="orderOptions.items">
                        <el-table-column label="编号" prop="pno" />
                        <el-table-column label="名称" prop="name" />
                        <el-table-column label="数量" prop="nums" />
                      </el-table>
                    </el-card>
                    <el-card v-if="form.buss == '1'">
                      <div slot="header" class="clearfix">
                        <span>车辆附件</span>
                      </div>
                      <el-card class="fl mr10 mb10" style="width: 32%">
                          <div slot="header" class="clearfix">
                            <span>全车外观</span>
                          </div>
                      <!--    <template v-for="pics in orderOptions.carOss">
                            <el-image :src="pics.url" style="width: 120px;height: 80px;margin-right: 10px;"
                             :preview-src-list="[pics.url]"/>
                          </template> -->
                          <!-- <el-image
                            style="width: 120px; height: 80px;margin-right: 10px;" :src="ossTransfer(orderOptions.carOss,'one')" fit="scale-down"
                            :preview-src-list="ossTransfer(orderOptions.carOss,'list')"></el-image> -->
                            <el-image v-if="orderOptions.facadeOss && orderOptions.facadeOss.length > 0" v-for="(pic,pindex) in orderOptions.facadeOss"
                            style="width: 120px; height: 60px;margin-right: 5px;" :src="ossTransferThumbnail(pic,'one')" fit="scale-down"
                            :preview-src-list="ossTransfer(orderOptions.facadeOss,'list')"></el-image>
                        </el-card>
                      <el-card class="fl mr10 mb10" style="width: 32%">
                        <div slot="header" class="clearfix">
                          <span>车架号</span>
                        </div>
                    <!--    <template v-for="pics in orderOptions.carOss">
                          <el-image :src="pics.url" style="width: 120px;height: 80px;margin-right: 10px;"
                           :preview-src-list="[pics.url]"/>
                        </template> -->
                        <!-- <el-image
                          style="width: 120px; height: 80px;margin-right: 10px;" :src="ossTransfer(orderOptions.carOss,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.carOss,'list')"></el-image> -->
                          <el-image v-if="orderOptions.carOss && orderOptions.carOss.length > 0" v-for="(pic,pindex) in orderOptions.carOss"
                          style="width: 120px; height: 60px;margin-right: 5px;" :src="ossTransferThumbnail(pic,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.carOss,'list')"></el-image>
                      </el-card>
                      <el-card class="fl mr10 mb10" style="width: 32%">
                        <div slot="header" class="clearfix">
                          <span>交接现场</span>
                        </div>
                        <!-- <template v-for="pics in orderOptions.handoverOss">
                          <el-image :src="pics.url" style="width: 120px;height: 80px;margin-right: 10px;"
                           :preview-src-list="[pics.url]"/>
                        </template> -->
                        <!-- <el-image
                          style="width: 120px; height: 80px;margin-right: 10px;" :src="ossTransfer(orderOptions.handoverOss,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.handoverOss,'list')"></el-image> -->
                          <el-image v-if="orderOptions.handoverOss && orderOptions.handoverOss.length > 0" v-for="(pic,pindex) in orderOptions.handoverOss"
                          style="width: 120px; height: 60px;margin-right: 5px;" :src="ossTransferThumbnail(pic,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.handoverOss,'list')"></el-image>
                      </el-card>
                      <el-card class="fl mr10 mb10" style="width: 32%" v-if="orderOptions.loadOss && orderOptions.loadOss.length > 0">
                        <div slot="header" class="clearfix">
                          <span>45度装车</span>
                        </div>
                        <!-- <template v-for="pics in orderOptions.loadOss">
                          <el-image :src="pics.url" style="width: 120px;height: 80px;margin-right: 10px;"
                           :preview-src-list="[pics.url]"/>
                        </template> -->
                        <!-- <el-image
                          style="width: 120px; height: 80px;margin-right: 10px;" :src="ossTransfer(orderOptions.loadOss,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.loadOss,'list')"></el-image> -->
                          <el-image v-if="orderOptions.loadOss && orderOptions.loadOss.length > 0" v-for="(pic,pindex) in orderOptions.loadOss"
                          style="width: 120px; height: 60px;margin-right: 5px;" :src="ossTransferThumbnail(pic,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.loadOss,'list')"></el-image>
                      </el-card>
                      <el-card class="fl mr10 mb10" style="width: 32%">
                        <div slot="header" class="clearfix">
                          <span>外观瑕疵</span>
                        </div>
                        <!-- <template v-for="pics in orderOptions.loadOss">
                          <el-image :src="pics.url" style="width: 120px;height: 80px;margin-right: 10px;"
                           :preview-src-list="[pics.url]"/>
                        </template> -->
                        <!-- <el-image
                          style="width: 120px; height: 80px;margin-right: 10px;" :src="ossTransfer(orderOptions.loadOss,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.loadOss,'list')"></el-image> -->
                          <el-image v-if="orderOptions.flawOss && orderOptions.flawOss.length > 0" v-for="(pic,pindex) in orderOptions.flawOss"
                          style="width: 120px; height: 60px;margin-right: 5px;" :src="ossTransferThumbnail(pic,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.flawOss,'list')"></el-image>
                      </el-card>
                      <el-card class="fl mr10 mb10" style="width: 32%">
                        <div slot="header" class="clearfix">
                          <span>到达目的地</span>
                        </div>
                        <!-- <template v-for="pics in orderOptions.takeOss">
                          <el-image :src="pics.url" style="width: 120px;height: 80px;margin-right: 10px;"
                           :preview-src-list="[pics.url]"/>
                        </template> -->
                        <!-- <el-image
                          style="width: 120px; height: 80px;margin-right: 10px;" :src="ossTransfer(orderOptions.takeOss,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.takeOss,'list')"></el-image> -->
                          <el-image v-if="orderOptions.takeOss && orderOptions.takeOss.length > 0" v-for="(pic,pindex) in orderOptions.takeOss"
                          style="width: 120px; height: 60px;margin-right: 5px;" :src="ossTransferThumbnail(pic,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.takeOss,'list')"></el-image>
                      </el-card>
                      <el-card class="fl mr10 mb10" style="width: 32%">
                        <div slot="header" class="clearfix">
                          <span>卸车</span>
                        </div>
                        <!-- <template v-for="pics in orderOptions.unloadOss">
                          <el-image :src="pics.url" style="width: 120px;height: 80px;margin-right: 10px;"
                           :preview-src-list="[pics.url]"/>
                        </template> -->
                       <!-- <el-image
                          style="width: 120px; height: 80px;margin-right: 10px;" :src="ossTransfer(orderOptions.unloadOss,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.unloadOss,'list')"></el-image> -->
                          <el-image v-if="orderOptions.unloadOss && orderOptions.unloadOss.length > 0" v-for="(pic,pindex) in orderOptions.unloadOss"
                          style="width: 120px; height: 60px;margin-right: 5px;" :src="ossTransferThumbnail(pic,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.unloadOss,'list')"></el-image>
                      </el-card>
                      <el-card class="fl mr10 mb10" style="width: 32%">
                        <div slot="header" class="clearfix">
                          <span>其他</span>
                        </div>
                        <!-- <template v-for="pics in orderOptions.otherOss">
                          <el-image :src="pics.url" style="width: 120px;height: 80px;margin-right: 10px;"
                           :preview-src-list="[pics.url]"/>
                        </template> -->
                        <!-- <el-image
                          style="width: 120px; height: 80px;margin-right: 10px;" :src="ossTransfer(orderOptions.otherOss,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.otherOss,'list')"></el-image> -->
                          <el-image v-if="orderOptions.otherOss && orderOptions.otherOss.length > 0" v-for="(pic,pindex) in orderOptions.otherOss"
                          style="width: 120px; height: 60px;margin-right: 5px;" :src="ossTransferThumbnail(pic,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.otherOss,'list')"></el-image>
                      </el-card>
                      <el-card class="fl mr10 mb10" style="width: 32%">
                        <div slot="header" class="clearfix">
                          <span>其他</span>
                        </div>
                        <!-- <template v-for="pics in orderOptions.otherOss">
                          <el-image :src="pics.url" style="width: 120px;height: 80px;margin-right: 10px;"
                           :preview-src-list="[pics.url]"/>
                        </template> -->
                        <!-- <el-image
                          style="width: 120px; height: 80px;margin-right: 10px;" :src="ossTransfer(orderOptions.otherOss,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.otherOss,'list')"></el-image> -->
                          <el-image v-if="orderOptions.otherTwoOss && orderOptions.otherTwoOss.length > 0" v-for="(pic,pindex) in orderOptions.otherTwoOss"
                          style="width: 120px; height: 60px;margin-right: 5px;" :src="ossTransferThumbnail(pic,'one')" fit="scale-down"
                          :preview-src-list="ossTransfer(orderOptions.otherTwoOss,'list')"></el-image>
                      </el-card>
                    </el-card>
                  </el-tab-pane>
                  <el-tab-pane label="运单信息" v-if="orderOptions.wayItems && orderOptions.wayItems.length > 0">
                    <template v-for="item in orderOptions.wayItems">
                      <el-steps :active="item.status == 2?0:(item.status == 3?1:(item.status == 5?2:3))" align-center process-status="finish" finish-status="success" simple style="margin-bottom: 10px;">
                        <el-step title="发车"></el-step>
                        <el-step title="到达"></el-step>
                        <el-step title="签收"></el-step>
                        <el-step title="完成"></el-step>
                      </el-steps>
                      <el-tabs v-model="wayName">
                        <el-tab-pane label="基本信息" name="1">
                          <el-descriptions :column="3" border>
                            <el-descriptions-item label="运单编号">{{item.waybillNo}}</el-descriptions-item>
                            <el-descriptions-item label="线路">{{item.lineName}}</el-descriptions-item>
                            <el-descriptions-item label="车次">{{item.scheduleName}}</el-descriptions-item>
                            <el-descriptions-item label="车牌号">{{item.carNumber}}</el-descriptions-item>
                            <el-descriptions-item label="司机" :span="2">{{item.driverName}}</el-descriptions-item>
                            <el-descriptions-item label="物品数量">{{item.nums}}</el-descriptions-item>
                          </el-descriptions>
                        </el-tab-pane>
                        <el-tab-pane label="物品清单" name="2">
                          <el-card>
                            <el-table :data="item.items">
                              <el-table-column label="编号" prop="pno" />
                              <el-table-column label="名称" prop="name" />
                              <el-table-column label="数量" prop="nums" />
                            </el-table>
                          </el-card>

                        </el-tab-pane>
                        <el-tab-pane label="日志跟踪" name="3">
                          <el-card>
                            <el-table :data="item.logItems">
                              <el-table-column label="操作人" prop="operator" />
                              <el-table-column label="节点名称">
                                <template slot-scope="scope">
                                  <dict-tag :options="dict.type.tms_track_log_type" :value="scope.row.type" />
                                </template>
                              </el-table-column>
                              <el-table-column label="操作时间" prop="createTime"></el-table-column>
                              <el-table-column label="备注" prop="memeo" />
                            </el-table>
                          </el-card>
                        </el-tab-pane>
                      </el-tabs>
                    </template>
                  </el-tab-pane>
                </el-tabs>
            </el-tab-pane>
            <el-tab-pane label="挑拣任务" name="6" v-if="putTaskOptions && putTaskOptions.length > 0">
              <template v-for="item in putTaskOptions">
                <el-card style="margin-bottom: 15px;">
                  <!-- <el-button v-if="form.type == '2'" class="fr mb10" type="primary" size="mini" @click="handlePick(item)">挑拣</el-button> -->
                  <el-descriptions :column="3" border>
                    <el-descriptions-item label="任务编号">{{item.pickNo}}</el-descriptions-item>
                    <el-descriptions-item label="挑拣员">{{item.nickName}}</el-descriptions-item>
                    <el-descriptions-item label="状态">
                      <dict-tag :options="dict.type.wms_pick_task_status" :value="item.status" />
                    </el-descriptions-item>
                  </el-descriptions>
                  <el-card style="margin-top: 15px;" shadow="never">
                    <div slot="header" class="clearfix">
                      <span>物品清单</span>
                    </div>
                    <el-table :data="item.items">
                      <el-table-column label="编号" prop="pno" />
                      <el-table-column label="名称" prop="name" />
                      <el-table-column label="数量" prop="nums" />
                      <el-table-column label="状态" prop="nums">
                        <template slot-scope="scope">
                          <dict-tag :options="dict.type.wms_pick_task_status" :value="scope.row.status" />
                        </template>
                      </el-table-column>
                    </el-table>
                  </el-card>
                </el-card>
              </template>
            </el-tab-pane>
            <el-tab-pane label="操作日志" name="7">
              <el-table :data="logOptions" border stripe>
                <el-table-column label="序号" type="index" width="50" align="center"/>
                <el-table-column label="操作时间" align="left" prop="logTime" width="180"/>
                <el-table-column label="操作人" align="left" prop="operator" width="200"/>
                <el-table-column label="操作内容" align="left" prop="content" />
              </el-table>
            </el-tab-pane>
          </el-tabs>
        </el-card>
    </el-drawer>
    <el-dialog :visible.sync="showAll" :before-close="handleClose" title="下发信息" width="55%">
      <el-descriptions  :column="3" border>
        <el-descriptions-item label="存放位置" :span="3">
          <el-radio-group v-model="sendTaskForm.storeId">
            <el-radio-button v-for="item in storeOptions" :key="item.id" :label="item.id">
              {{item.label}}
            </el-radio-button>
          </el-radio-group>
        </el-descriptions-item>
        <el-descriptions-item label="承运商" :span="3">
          <el-radio-group v-model="sendTaskForm.carrierDeptId">
            <el-radio-button v-for="item in carrierOptions" :key="item.deptId" :label="item.deptId">
              {{item.carrierName}}
            </el-radio-button>
          </el-radio-group>
        </el-descriptions-item>
        <template>
          <el-descriptions-item label="派遣车辆" :span="2">
            <el-select v-model="sendTaskForm.carId">
              <el-option v-for="item in carOptions" :key="item.id" :label="item.carNumber" :value="item.id"></el-option>
            </el-select>
          </el-descriptions-item>
          <el-descriptions-item label="取件人" :span="1">
            <el-select v-model="sendTaskForm.pickupId">
              <el-option v-for="item in userOptions" :key="item.userId" :label="item.nickName" :value="item.userId"></el-option>
            </el-select>
          </el-descriptions-item>
        </template>
      </el-descriptions>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" :loading="buttonLoading" @click="submitAllForm" size="mini">确 定</el-button>
        <el-button @click="handleCloseAll" size="mini">取 消</el-button>
      </div>
    </el-dialog>
    <el-drawer  title="调用审核"  :visible.sync="checkShow" size="75%" :before-close="handleCheckClose">
      <div class="mainDiv">
        <el-container class="main_container">
          <el-main style="padding-top: 60px;">
            <el-card>
              <el-tabs>
                <el-tab-pane label="申请详情">
                  <el-card>
                    <el-descriptions title="基本信息" :column="3" border>
                      <el-descriptions-item label="申请单位">{{form.deptName}}</el-descriptions-item>
                      <el-descriptions-item label="申请人">{{form.name}}</el-descriptions-item>
                      <el-descriptions-item label="联系电话">{{form.tel}}</el-descriptions-item>
                      <el-descriptions-item v-if="form.delivery == '0'" label="寄件地址" :span="3">{{form.address}}</el-descriptions-item>
                      <el-descriptions-item label="物流配送">
                        <dict-tag :options="dict.type.oms_out_delivery_type" :value="form.delivery" />
                      </el-descriptions-item>
                      <el-descriptions-item label="物品数量">{{form.nums}}</el-descriptions-item>
                      <el-descriptions-item label="出库仓库">{{form.storeName}}</el-descriptions-item>
                      <el-descriptions-item label="调用原因">{{form.dispatchRemark}}</el-descriptions-item>
                    </el-descriptions>
                  </el-card>
                  <el-card style="margin-top: 10px;">
                    <el-table :data="form.items"  border stripe>
                      <el-table-column label="物品编号" align="center" prop="pno">
                        <template slot-scope="scope">
                          <span>{{scope.row.pno}}</span>
                        </template>
                      </el-table-column>
                      <el-table-column label="物品名称" align="center" prop="name">
                        <template slot-scope="scope">
                          <span>{{scope.row.name}}</span>
                        </template>
                      </el-table-column>
                      <el-table-column label="数量" align="center" prop="nums">
                        <template slot-scope="scope">
                          <span>{{scope.row.nums}}</span>
                        </template>
                      </el-table-column>
                      <el-table-column label="箱号" align="center" prop="boxNo">
                        <template slot-scope="scope" v-if="scope.row.boxNo">
                          <el-tag>{{scope.row.boxNo}}</el-tag>
                        </template>
                      </el-table-column>
                      <el-table-column label="图片" prop="oss" align="center">
                        <template slot-scope="scope">
                            <el-image v-if="scope.row.oss && scope.row.oss.length > 0" v-for="(pic,pindex) in scope.row.oss"
                            style="width: 120px; height: 60px;margin-right: 5px;" :src="ossTransferThumbnail(pic,'one')" fit="scale-down"
                            :preview-src-list="ossTransfer(scope.row.oss,'list')"></el-image>
                        </template>
                      </el-table-column>
                    </el-table>
                  </el-card>
                </el-tab-pane>
              </el-tabs>
            </el-card>
          </el-main>
          <el-footer>
            <div class="fl">
              <el-radio-group v-model="form.checkStatus">
                  <el-radio :label="1">审核通过</el-radio>
                  <el-radio :label="2">审核不通过</el-radio>
              </el-radio-group>
            </div>
            <div class="fl ml10">
              <el-input v-if="form.checkStatus == '2'" v-model="form.remark" placeholder="请输入不通过理由"></el-input>
            </div>
            <div>
              <el-button type="primary" :loading="buttonLoading" @click="submitCheck" size="mini">确 定</el-button>
              <el-button @click="handleCheckClose" size="mini">取 消</el-button>
            </div>
          </el-footer>
        </el-container>
        </div>
    </el-drawer>
  </div>
</template>
<script>
  import { storeTreeselect,listStore} from "@/api/wms/store";
  import { treeselect} from "@/api/system/dept";
  import { listTask,getTask,getStatisticsTask,updateTask } from "@/api/oms/task";
  import { sendsTask,getCarrierUser } from "@/api/center/index";
  import {listHandover,listHandoverInfo} from '@/api/wms/handover'
  import {listOss} from '@/api/system/oss'
  import {getOrderTask} from '@/api/tms/order';
  // import {getPutTaskByTask} from '@/api/wms/putTask';
  import {getPickTask} from '@/api/wms/pick'
  import {listOperatorLog} from "@/api/oms/operatorLog"
  import {listCarrier} from "@/api/tms/carrier"
  import {listCar} from "@/api/tms/car"
  import Treeselect from "@riophae/vue-treeselect";
  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  import {htmlToPdf,htmlToPdfInfo} from "@/utils/pdf.js"
  export default {
      dicts:['tms_track_log_type','wms_delivery_type','oms_task_type','oms_task_source','oms_task_status','oms_property_type','handover_dtl_status','oms_send_status','wms_pick_task_status','sys_check_status','oms_out_delivery_type'],
      components:{Treeselect},
      data(){
        return{
          /**
           * 左侧筛选
           */
          storeName: undefined,
          storeOptions:[],
          defaultProps: {
            children: "children",
            label: "label"
          },

          statisticsOptions:[],

          /**
           * 右侧数据
           */
          // 遮罩层
          loading: true,
          // 显示搜索条件
          showSearch: true,
          // 显示承运商搜索
          show:false,
          showAll:false,
          checkShow:false,
          // 非单个禁用
          single: true,
          // 非多个禁用
          multiple: true,
          // 总条数
          total: 0,
          taskList:[],
          // 查询参数
          deptOptions:[],
          daterangeCreateTime:[],
          queryParams: {
            pageNum: 1,
            pageSize: 10,
            type:undefined,
            storeId:undefined,
            deptId:undefined,
            taskNo:undefined,
            delivery:undefined,
            status: undefined,
            orderTime:undefined,
            delFlag:'0',
            proKey:undefined,
            params:{
              beginCreateTime:undefined,
              endCreateTime:undefined
            }
          },
          //详情
          form:{},
          open:false,
          title:undefined,
          activeName:'1',
          wayName:'1',
          //详情-交接
          handoverOptions:[],
          //详情-订单
          orderOptions:{},
          //详情-上架
          putTaskOptions:{},
          //详情-日志
          logOptions:[],
          //承运商筛选
          carrierOptions:[],
          //车辆筛选
          carOptions:[],
          //派遣人筛选
          userOptions:[],
          handoverOssList:[],

          carrierName:undefined,
          sendTaskForm:{
            carrierDeptId:undefined,
            storeId:undefined,
            carId:undefined,
            pickupId:undefined
          },
          rules: {
            carrierDeptId: [{
              required: true,
              message: "承运商不能为空",
              trigger: "change"
            }],
            storeId: [{
              required: true,
              message: "存放位置不能为空",
              trigger: "change"
            }],
          },
          buttonLoading:false,

          tabs:[
            {label:undefined,name:'全部',badge:undefined,value:undefined},
            {label:'0',name:'待下发',badge:undefined,value:'0'},
            {label:'1',name:'已下发',badge:undefined,value:'1'}
          ],
          isFour:false,
          xzTabVal: 0,
          xzTabs: [
            { label: '0', name: '刑事类', badge: undefined, xzType: 'xs', delFlag: '0', delivery: undefined },
            { label: '1', name: '行政类', badge: undefined, xzType: 'xz', delFlag: '0', delivery: '0' },
          ]
        }
      },
      activated() {
          const time = this.$route.query.t;
          if (time != null && time != this.uniqueId) {
            this.uniqueId = time;
            this.queryParams.pageNum = Number(this.$route.query.pageNum);
            this.getList();
          }
      },
      created(){
        this.queryParams.type = this.$router.currentRoute.query.type ? this.$router.currentRoute.query.type:'0'
        this.getStoreTreeselect();
        this.getList();
        this.getTreeselect();
        this.getStatistics();
        this.getUser();
      },
      watch:{
        'sendTaskForm.carrierDeptId':{
          handler(newVal){
            if(newVal){
              this.carrierOptions.forEach(item=>{
                if(item.deptId == newVal){
                  this.carrierName = item.carrierName;
                }
              })
              this.getCar(newVal);
            }
          }
        }
      },
      methods: {
        /** 查询出入库订单列表 */
        getList() {
          this.loading = true;
          if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
            this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
            this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
          }
          this.queryParams.xzType = this.xzTabVal;
          listTask(this.queryParams).then(response => {
            this.taskList = response.rows;
            this.total = response.total;
            this.loading = false;

            this.tabs.forEach((item)=>{
            	if(item.label == this.queryParams.sendStatus){
            		item.badge = this.total;
            	}else{
            		item.badge = undefined;
            	}
            })
          });
        },
        radioChange(e){
          this.tabs.forEach(item=>{
              if(item.label == e){
                this.queryParams.sendStatus = item.value;
              }
          })
          this.getList();
        },
        xzTabChange(e){
          this.getList()
        },
        getStatistics(){
          getStatisticsTask({type:'3',delFlag:'0'}).then(response=>{
            this.statisticsOptions = response.data.result;
          })
        },
        statisticsChange(item){
          this.queryParams.region = item.region;
          this.getList();
        },

        getShowFour(length,item){
          if(length == 1 && item.htype == '0'){
              this.isFour = true;
              return  6;
          }else{
            this.isFour = false;
            return 8;
          }

        },

        /**
         * 左侧操作
         */
        /** 查询分类下拉树结构 */
        getStoreTreeselect() {
          storeTreeselect().then(response => {
            this.storeOptions = response.data;
          });
        },
        // 筛选节点
        filterNode(value, data) {
          if (!value) return true;
          return data.label.indexOf(value) !== -1;
        },
        // 节点单击事件
        handleNodeClick(data) {
          this.queryParams.storeId = data.id;
          this.form.storeId = data.id;
          this.handleQuery();
        },
        /**
         * 右侧数据
         */
        /** 查询部门下拉树结构 */
        getTreeselect() {
          treeselect().then(response => {
            this.deptOptions = response.data;
          });
        },
        /** 查询订单信息 */
        getOrderInfo(id){
          getOrderTask(id).then(response=>{
            this.orderOptions = response.data;
          })
        },
        /** 查询上架信息 */
        getPutTaskInfo(id){
          getPickTask(id).then(response=>{
            this.putTaskOptions = response.data;
          })
        },
        /** 查询交接信息 */
        getHandover(id){
          listHandoverInfo({'objid':id}).then(response=>{
            this.handoverOptions = response.data;
          })
        },
        /** 查询日志 */
        getLogs(id){
          listOperatorLog({"objid":id}).then(response=>{
            this.logOptions = response.rows;
          })
        },
        /** 查询车辆 */
        getCar(carrierDeptId){
          listCar({carrierDeptId:carrierDeptId}).then(response=>{
            // if(response.rows.length == 0 && this.carrierName.indexOf('车辆') == -1){
            //   this.$modal.notifyWarning("当前承运商暂无车辆信息，请联系该承运商！");
            // }
            this.carOptions = response.rows;
          })
        },
        getUser(){
          getCarrierUser().then(response=>{
            this.userOptions = response.data;
          })
        },
        getHandoverOss(objid){
          listOss({'objid':objid,'buss':'handoverDtl'}).then(response=>{
            console.info('getHandoverOss======>',response)
            this.handoverOssList = response.rows;
          })
        },

        /** 搜索按钮操作 */
        handleQuery() {
          this.queryParams.pageNum = 1;
          // if(this.queryParams.orderTime){
          //   this.queryParams.params.beginCreateTime = this.queryParams.orderTime+'00:00:00'
          //   this.queryParams.params.endCreateTime = this.queryParams.orderTime+'23:59:59'
          // }
          this.getList();
        },
        /** 重置按钮操作 */
        resetQuery() {
          this.daterangeCreateTime=[];
          this.resetForm("queryForm");
          // this.queryParams.orderTime = undefined;
          this.queryParams.params.beginCreateTime = undefined;
          this.queryParams.params.endCreateTime = undefined;
          this.queryParams.region = undefined;
          this.handleQuery();
        },
        // 多选框选中数据
        handleSelectionChange(selection) {
          this.ids = selection.map(item => item.id)
          this.single = selection.length !== 1
          this.multiple = !selection.length
        },

        //查看详情
        handleInfo(row){
          getTask(row.id).then(response=>{
            this.form = response.data;
            this.open = true;
            this.title = '调用申请详情';
            this.activeName = '1';
            //交接明细
            this.getHandover(row.id);
            this.getOrderInfo(row.id);
            this.getPutTaskInfo(row.id);
            this.getLogs(row.id);
            this.getHandoverOss(row.id);
          })
        },

        //详情关闭
        close(){
          this.open = false;
        },
        //关闭
        handleClose(){
          this.show = false;
          this.buttonLoading = false;
        },
        handleCheckClose(){
          this.checkShow = false;
          this.buttonLoading = false;
        },
        handleCloseAll(){
          this.showAll = false;
          this.buttonLoading = false;
        },
        handleCheck(row){
          this.checkShow = true;
          getTask(row.id).then(response=>{
            this.form = response.data;
            this.checkShow = true;
          })
        },
        //审核
        submitCheck(){
          let content = '是否确认审核通过';
          if(this.form.checkStatus == 2){
            content = '是否确认审核不通过'
          }
          this.buttonLoading = true;
          this.$modal.confirm(content).then(() => {
            this.loading = true;
            return updateTask(this.form);
          }).then(() => {
            this.loading = false;
            this.buttonLoading = false;
            this.handleCheckClose();
            this.close();
            this.getList();
            this.$modal.msgSuccess("审核完成");
          }).finally(() => {
            this.loading = false;
            this.buttonLoading = false;
          });
        },
        /**
         * 右侧列表-操作
         */
        //新增
        handleAdd(){
          this.$router.push({
            path: '/oms/transferInfo/add',
            query: {
              pageNum: this.queryParams.pageNum
            }
          })
        },
        //编辑
        handleUpdate(row){
          const id = row.id || this.ids
          this.close();
          this.$router.push({
            path: '/oms/transferInfo/edit/'+id,
            query: {
              pageNum: this.queryParams.pageNum
            }
          })
        },
        handleSendAll(){
          this.sendTaskForm = {};
          listCarrier().then(response=>{
            this.carrierOptions = response.rows;
            this.showAll = true;
            this.carOptions = [];
          })
        },
        handleSend(row){
          this.sendTaskForm = {};
          this.sendTaskForm.id = row.id;
          this.sendTaskForm.storeId = row.storeId;
          listCarrier().then(response=>{
            this.carrierOptions = response.rows;
            this.show = true;
            this.carOptions = [];
          })

          // let content = '是否确认下发所选数据项?'
          // if(row.sendStatus == '1'){
          //   content = '已有下发数据，重新下发将覆盖原数据，是否下发?'
          // }
          // const ids = row.id || this.ids;
          // this.$modal.confirm(content).then(() => {
          //   this.loading = true;
          //   return sendsTask(ids);
          // }).then(() => {
          //   this.loading = false;
          //   this.getList();
          //   this.$modal.msgSuccess("下发成功");
          // }).finally(() => {
          //   this.loading = false;
          // });
        },
        /**
         * 打印交接单
         * @param {Object} title
         */
        handlePrint(title){
          // const printOrder = this.$refs['printOrder'];
          htmlToPdf('#printOrder',title)
        },
        handlePrintInfo(title){
          htmlToPdfInfo("#printOrder");
        },
        handlePrintPre(title){
          // const printOrder = this.$refs['printOrder'];
          htmlToPdf('#printOrderPre',title)
        },
        submitAllForm(){
          let form = this.sendTaskForm;

          if(!form.storeId){
             this.$modal.msgError("请选择存放位置！");
             return false;
          }
          if(!form.carrierDeptId){
             this.$modal.msgError("请选择承运商！");
             return false;
          }
          // if(!form.carId && this.carrierName.indexOf('车辆') == -1){
          //    this.$modal.msgError("请选择车辆！");
          //    return false;
          // }

          // if(!form.pickupId && this.carrierName.indexOf('车辆') == -1){
          //    this.$modal.msgError("请选择派遣人！");
          //    return false;
          // }

          this.buttonLoading = true;
          let content = '是否确认下发所选数据项?'
          if(this.form.sendStatus == '1'){
            content = '已有下发数据，重新下发将覆盖原数据，是否下发?'
          }
          const ids = form.id || this.ids;
          this.$modal.confirm(content).then(() => {
            this.loading = true;
            form.ids = Array.isArray(ids)?ids:[ids];
            return sendsTask(form);
          }).then(() => {
            this.$modal.msgSuccess("下发成功");
          }).finally(() => {
            this.loading = false;
            this.buttonLoading = false;
            this.handleCloseAll();
            this.close();
            this.getList();
          });
        },

        submitForm(){
          let form = this.sendTaskForm;

          if(!form.storeId){
           this.$modal.msgError("请选择存放位置！");
            return false;
          }
          if(!form.carrierDeptId){
           this.$modal.msgError("请选择承运商！");
            return false;
          }
          // if(!form.carId && this.carrierName.indexOf('车辆') == -1){
          //    this.$modal.msgError("请选择车辆！");
          //    return false;
          // }

          // if(!form.pickupId && this.carrierName.indexOf('车辆') == -1){
          //    this.$modal.msgError("请选择派遣人！");
          //    return false;
          // }
            this.buttonLoading = true;
            let content = '是否确认下发所选数据项?'
            if(this.form.sendStatus == '1'){
              content = '已有下发数据，重新下发将覆盖原数据，是否下发?'
            }
            const ids = form.id || this.ids;
            this.$modal.confirm(content).then(() => {
              this.loading = true;
              form.ids = Array.isArray(ids)?ids:[ids];
              return sendsTask(form);
            }).then(() => {
              this.$modal.msgSuccess("下发成功");
            }).finally(() => {
              this.loading = false;
              this.buttonLoading = false;
              this.handleClose();
              this.close();
              this.getList();
            })
        },
        /** 删除按钮操作 */
        handleDelete(row) {
          const ids = row.id || this.ids;
          this.$modal.confirm('是否确认删除出入库订单编号为"' + ids + '"的数据项？').then(() => {
            this.loading = true;
            return delTask(ids);
          }).then(() => {
            this.loading = false;
            this.getList();
            this.$modal.msgSuccess("删除成功");
          }).finally(() => {
            this.loading = false;
          });
        },
        /** 导出按钮操作 */
        handleExport() {
          this.download('oms/task/export', {
            ...this.queryParams
          }, `task_${new Date().getTime()}.xlsx`)
        }
      },
  }
</script>
<style>
  #handoverCard.box-card .el-card__header {
     border-bottom-color: #000;
   }

   /**
   改变边框颜色
    */
    #handoverCard.box-card .el-table {
     border-bottom: 1px solid #000;
     border-right: 1px solid #000;
     margin: 0 auto;
   }

   #handoverCard.box-card .el-table th {
     border: 1px solid black !important;
     border-right: none !important;
     border-bottom: none !important;
   }

    #handoverCard.box-card .el-table td {
     border: 1px solid black;
     border-right: none !important;
   }
   .el-badge__content.is-fixed{
     z-index: 1;
   }
</style>
